# File Managed by Puppet

<VirtualHost *:<%= @port %>>
    ServerAdmin <%= @server_admin_email %>
    DocumentRoot <%= @real_docroot %>
<% if @server_name_value != false -%>
    ServerName <%= @server_name_value %>
<% end -%>
<% if @serveraliases != "" -%>
<% if @serveraliases.is_a? Array -%>
    ServerAlias <%= @serveraliases.flatten.join(" ") %>
<% else -%>
    ServerAlias <%= @serveraliases %>
<% end -%>
<% end -%>
<% if env_variables != "" -%>
<% if env_variables.is_a? Array -%>
<% env_variables.each do |envvars| -%>
    SetEnv <%= envvars %>
<% end -%>
<% end -%>
<% end -%>

    ErrorLog  <%= scope.lookupvar('apache::log_dir') %>/<%= @name %>-error_log
    CustomLog <%= scope.lookupvar('apache::log_dir') %>/<%= @name %>-access_log common

<% if @bool_passenger -%>
    PassengerHighPerformance <%= @bool_passenger_high_performance ? "On" : "Off" %>
    PassengerMaxPoolSize <%= @passenger_max_pool_size %>
    PassengerPoolIdleTime <%= @passenger_pool_idle_time %>
    PassengerMaxRequests <%= @passenger_max_requests %>
    PassengerStatThrottleRate <%= @passenger_stat_throttle_rate %>
    RackAutoDetect <%= @bool_passenger_rack_auto_detect ? "On" : "Off" %>
    RailsAutoDetect <%= @bool_passenger_rails_auto_detect ? "On" : "Off" %>

    <% if @passenger_rails_env != ''      %>RailsEnv <%= @passenger_rails_env %><% end %>
    <% if @passenger_rack_env != ''       %>RackEnv <%= @passenger_rack_env %><% end %>
    <% if @passenger_rails_base_uri != '' %>RailsBaseURI <%= @passenger_rails_base_uri %><% end %>
    <% if @passenger_rack_base_uri != ''  %>RackBaseURI <%= @passenger_rack_base_uri %><% end %>

<% end -%>
<% if @directory_options != "" || @directory_allow_override != "None" -%>
    <Directory <%= @real_directory %>>
        <% if @directory_options != "" -%>
        Options <%= @directory_options %>
        <% end -%>
        <% if @directory_allow_override != "None" -%>
        AllowOverride <%= @directory_allow_override %>
        <% end -%>
    </Directory>
<% end -%>
</VirtualHost>
